﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Core.Constants;
using Core.PageInterfaces;

namespace Core.PageEntities
{
    public partial class SitePageGroup : EntityModel, ISitePageGroup
    {
        public virtual int Id { get; set; }
        [Required]
        [RegularExpression(ConstantsRegex.STR_URL_SECTION, ErrorMessage = ConstantsValidation.STR_URL_VALIDATION_ERROR)]
        public virtual string GroupName { get; set; }

        public virtual ICollection<SitePageDefinition> SitePageDefinition { get; set; }

        protected override void Validate()
        {
            base.Validate();
            ValidateCollection((this.SitePageDefinition.ToList().ConvertAll(x => (EntityModel)x)));
        }
    }
}
